package reflect;

import reflect.annotations.AutoRunClass;

/**
 * 反射机制访问类上的注解
 */
public class ReflectDemo10 {
    public static void main(String[] args) throws ClassNotFoundException {
        //查看Person类上是否有注解@AutoRunClass

        //1:获取Person的类对象
        Class cls = Class.forName("reflect.Person");
        //2:通过类对象判断当前类是否被指定注解标注了
        boolean mark = cls.isAnnotationPresent(AutoRunClass.class);
        if(mark){
            System.out.println("被标注了!");
        }else{
            System.out.println("没有被标注!");
        }
    }
}
